#include <asm.h>
#include <regdef.h>
#include <inst_test.h>

LEAF(n68_swr_test)
    .set noreorder
    addiu s0, s0, 1
    li  s2, 0x0
###test inst
    TEST_SWR(0xe473ea82, 0xfa531ac0, 0x800d0000, 0x0000f778, 0x0000f778, 0xfa531ac0)
    TEST_SWR(0x26a58d80, 0xce3a8910, 0x800d0000, 0x000058a8, 0x000058a8, 0xce3a8910)
    TEST_SWR(0x88a5c415, 0xa5fceb30, 0x800d0000, 0x00004920, 0x00004920, 0xa5fceb30)
    TEST_SWR(0x70c99a80, 0x9dad6dbe, 0x800d0000, 0x00009c64, 0x00009c64, 0x9dad6dbe)
    TEST_SWR(0xbc143594, 0x10414b84, 0x800d0000, 0x0000723c, 0x0000723c, 0x10414b84)
    TEST_SWR(0xfda4efe8, 0x0213424c, 0x800d0000, 0x000008b9, 0x000008b8, 0x13424ce8)
    TEST_SWR(0xef475496, 0xb0c63f98, 0x800d0000, 0x000036c9, 0x000036c8, 0xc63f9896)
    TEST_SWR(0x1b5e6120, 0x40e42f28, 0x800d0000, 0x00003280, 0x00003280, 0x40e42f28)
    TEST_SWR(0x7579c07b, 0xfb583c8c, 0x800d0000, 0x0000760f, 0x0000760c, 0x8c79c07b)
    TEST_SWR(0x13fa054c, 0xeefdb448, 0x800d0000, 0x0000ce9a, 0x0000ce98, 0xb448054c)
    TEST_SWR(0x8b50c1de, 0x0de47bbe, 0x800d0000, 0x00004ba8, 0x00004ba8, 0x0de47bbe)
    TEST_SWR(0x4c3e139a, 0xd4973298, 0x800d0000, 0x000054ba, 0x000054b8, 0x3298139a)
    TEST_SWR(0xe4ca0780, 0x35c18560, 0x800d0000, 0x00001a90, 0x00001a90, 0x35c18560)
    TEST_SWR(0x4731a4d2, 0xf6d1b1d0, 0x800d0000, 0x00001a79, 0x00001a78, 0xd1b1d0d2)
    TEST_SWR(0xa8756b80, 0xde29b9e8, 0x800d0000, 0x0000932a, 0x00009328, 0xb9e86b80)
    TEST_SWR(0x6a33bef8, 0x8b7f4410, 0x800d0000, 0x0000b800, 0x0000b800, 0x8b7f4410)
    TEST_SWR(0x74338dd8, 0x66316a48, 0x800d0000, 0x00008fea, 0x00008fe8, 0x6a488dd8)
    TEST_SWR(0x312413f0, 0xb1cb1450, 0x800d0000, 0x0000a6a4, 0x0000a6a4, 0xb1cb1450)
    TEST_SWR(0xd09e10d8, 0x537aebd4, 0x800d0000, 0x00007a29, 0x00007a28, 0x7aebd4d8)
    TEST_SWR(0x55f68274, 0x8c920548, 0x800d0000, 0x00004440, 0x00004440, 0x8c920548)
    TEST_SWR(0xfcd47ee4, 0xc53f0b1c, 0x800d0000, 0x000053ba, 0x000053b8, 0x0b1c7ee4)
    TEST_SWR(0xafdabb4e, 0x2f581038, 0x800d0000, 0x0000a8ec, 0x0000a8ec, 0x2f581038)
    TEST_SWR(0x10de0200, 0xb67ee6e9, 0x800d0000, 0x00001a0c, 0x00001a0c, 0xb67ee6e9)
    TEST_SWR(0xfd47681d, 0x767429d3, 0x800d0000, 0x0000e820, 0x0000e820, 0x767429d3)
    TEST_SWR(0x717ad0bc, 0xb1e6167c, 0x800d0000, 0x0000eda4, 0x0000eda4, 0xb1e6167c)
    TEST_SWR(0x55c192d8, 0x9d4eebc0, 0x800d0000, 0x0000696a, 0x00006968, 0xebc092d8)
    TEST_SWR(0x69d99360, 0xd1eb339c, 0x800d0000, 0x0000ea7d, 0x0000ea7c, 0xeb339c60)
    TEST_SWR(0x3319af5a, 0x42d78c90, 0x800d0000, 0x0000a11c, 0x0000a11c, 0x42d78c90)
    TEST_SWR(0xeadc8d4c, 0xf0dd3b90, 0x800d0000, 0x00008203, 0x00008200, 0x90dc8d4c)
    TEST_SWR(0x26bf1c00, 0x33171f52, 0x800d0000, 0x0000b700, 0x0000b700, 0x33171f52)
    TEST_SWR(0xb25f9680, 0x07a46ea8, 0x800d0000, 0x0000143a, 0x00001438, 0x6ea89680)
    TEST_SWR(0x88cae326, 0x64c7da90, 0x800d0000, 0x0000a78c, 0x0000a78c, 0x64c7da90)
    TEST_SWR(0xe8b6de5c, 0x3cc913cf, 0x800d0000, 0x000004a0, 0x000004a0, 0x3cc913cf)
    TEST_SWR(0x3dd36467, 0xa3301360, 0x800d0000, 0x00002633, 0x00002630, 0x60d36467)
    TEST_SWR(0x59e8d450, 0x9c6b7c37, 0x800d0000, 0x0000175f, 0x0000175c, 0x37e8d450)
    TEST_SWR(0x9156e1c6, 0xb3cd7c1e, 0x800d0000, 0x0000d160, 0x0000d160, 0xb3cd7c1e)
    TEST_SWR(0x6efe8526, 0xafa24fd8, 0x800d0000, 0x00009295, 0x00009294, 0xa24fd826)
    TEST_SWR(0xf43c47da, 0x9987644e, 0x800d0000, 0x000007bc, 0x000007bc, 0x9987644e)
    TEST_SWR(0x8abbff94, 0x1994f1da, 0x800d0000, 0x00009c58, 0x00009c58, 0x1994f1da)
    TEST_SWR(0xa285a5f0, 0xc4170772, 0x800d0000, 0x0000f6b8, 0x0000f6b8, 0xc4170772)
    TEST_SWR(0xf156170a, 0x35d45780, 0x800d0000, 0x0000afb0, 0x0000afb0, 0x35d45780)
    TEST_SWR(0xc8710928, 0x230706ec, 0x800d0000, 0x0000fe55, 0x0000fe54, 0x0706ec28)
    TEST_SWR(0x77f95f58, 0x22630b26, 0x800d0000, 0x00009819, 0x00009818, 0x630b2658)
    TEST_SWR(0xab2f5fa2, 0x93955778, 0x800d0000, 0x0000997b, 0x00009978, 0x782f5fa2)
    TEST_SWR(0x7039ab00, 0x2bffe430, 0x800d0000, 0x0000550e, 0x0000550c, 0xe430ab00)
    TEST_SWR(0x92d60ae0, 0xaacc8c40, 0x800d0000, 0x00008d8c, 0x00008d8c, 0xaacc8c40)
    TEST_SWR(0x430cd0e0, 0x17e934d0, 0x800d0000, 0x000049eb, 0x000049e8, 0xd00cd0e0)
    TEST_SWR(0x342a9eca, 0x236e6580, 0x800d0000, 0x0000bf9c, 0x0000bf9c, 0x236e6580)
    TEST_SWR(0xb478a08c, 0xf3151a80, 0x800d0000, 0x00007164, 0x00007164, 0xf3151a80)
    TEST_SWR(0x04c03218, 0x3d47bac0, 0x800d0000, 0x0000ffd2, 0x0000ffd0, 0xbac03218)
    
###detect exception
    bne s2, zero, inst_error
    nop
###score ++
    addiu s3, s3, 1
###output (s0<<24)|s3
inst_error:  
    sll t1, s0, 24
    or t0, t1, s3 
    sw t0, 0(s1)
    jr ra
    nop
END(n68_swr_test)
